<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>不向后兼容的变更</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="migration80.new-features.html">« 新特性</a></li>
      <li style="float: right;"><a href="migration80.deprecated.html">PHP 8.0 废弃的功能 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="migration80.html">从 PHP 7.4.x 移植到 PHP 8.0.x</a></li>
    <li>不向后兼容的变更</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="migration80.incompatible" class="sect1">
 <h2 class="title">不向后兼容的变更</h2>

 <div class="sect2" id="migration80.incompatible.core">
  <h3 class="title">PHP 核心中不向后兼容的变更</h3>

  <div class="sect3" id="migration80.incompatible.core.string-number-comparision">
   <h4 class="title">字符串与数字的比较</h4>

   <p class="para">
    数字与非数字形式的字符串之间的非严格比较现在将首先将数字转为字符串，然后比较这两个字符串。
    数字与数字形式的字符串之间的比较仍然像之前那样进行。
    请注意，这意味着 <code class="code">0 == &quot;not-a-number&quot;</code> 现在将被认为是 false 。
    <table class="doctable informaltable">
     
      <thead>
       <tr>
        <th>Comparison</th>
        <th>Before</th>
        <th>After</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td><code class="code">0 == &quot;0&quot;</code></td>
        <td><strong><code>true</code></strong></td>
        <td><strong><code>true</code></strong></td>
       </tr>

       <tr>
        <td><code class="code">0 == &quot;0.0&quot;</code></td>
        <td><strong><code>true</code></strong></td>
        <td><strong><code>true</code></strong></td>
       </tr>

       <tr>
        <td><code class="code">0 == &quot;foo&quot;</code></td>
        <td><strong><code>true</code></strong></td>
        <td><strong><code>false</code></strong></td>
       </tr>

       <tr>
        <td><code class="code">0 == &quot;&quot;</code></td>
        <td><strong><code>true</code></strong></td>
        <td><strong><code>false</code></strong></td>
       </tr>

       <tr>
        <td><code class="code">42 == &quot;   42&quot;</code></td>
        <td><strong><code>true</code></strong></td>
        <td><strong><code>true</code></strong></td>
       </tr>

       <tr>
        <td><code class="code">42 == &quot;42foo&quot;</code></td>
        <td><strong><code>true</code></strong></td>
        <td><strong><code>false</code></strong></td>
       </tr>

      </tbody>
     
    </table>

    
   </p>
  </div>

  <div class="sect3" id="migration80.incompatible.core.other">
   <h4 class="title">其它不向后兼容的变更</h4>

   <ul class="itemizedlist">
    <li class="listitem">
     <p class="para">
      <code class="literal">match</code> 现在是一个保留字。
     </p>
    </li>
    <li class="listitem">
     <p class="para">
     断言（Assertion）失败现在默认抛出异常。如果想要改回之前的行为，可以在 INI 设置中设置
      <code class="code">assert.exception=0</code> 。
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      <code class="literal">mixed</code> 现在是保留字，所以不能用于类，接口或者
      trait，也禁止在命名空间中使用。
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      与类名相同的方法名将不再被当做构造方法。应该使用<a href="language.oop5.decon.html#object.construct" class="link">__construct()</a>
      来取代它。
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      不再允许通过静态调用的方式去调用非静态方法。因此<span class="function"><a href="function.is-callable.html" class="function">is_callable()</a></span>在检查一个类名与非静态方法
      时将返回失败（应当检查一个类的实例）。
     </p>
    </li>
    <li class="listitem">
     <p class="para">
     <code class="code">(real)</code> 和 <code class="code">(unset)</code> 转换已被移除。
     </p>
    </li>
    <li class="listitem">
      <p class="para">
       The <a href="errorfunc.configuration.html#ini.track-errors" class="link">track_errors</a> ini directive has been removed. This
       means that <var class="varname">php_errormsg</var> is no longer available. The
       <span class="function"><a href="function.error-get-last.html" class="function">error_get_last()</a></span> function may be used instead.
      </p>
    </li>
    <li class="listitem">
     <p class="para">
      The ability to define case-insensitive constants has been removed. The third argument to
      <span class="function"><a href="function.define.html" class="function">define()</a></span> may no longer be <strong><code>true</code></strong>.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The ability to specify an autoloader using an <span class="function"><a href="function.autoload.html" class="function">__autoload()</a></span> function has been
      removed. <span class="function"><a href="function.spl-autoload-register.html" class="function">spl_autoload_register()</a></span> should be used instead.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The <code class="parameter">errcontext</code> argument will no longer be passed to custom error handlers
      set with <span class="function"><a href="function.set-error-handler.html" class="function">set_error_handler()</a></span>.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      <span class="function"><a href="function.create-function.html" class="function">create_function()</a></span> has been removed. Anonymous functions may be used instead.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      <span class="function"><a href="function.each.html" class="function">each()</a></span> has been removed. <a href="control-structures.foreach.html" class="link">foreach</a> or <span class="classname"><a href="class.arrayiterator.html" class="classname">ArrayIterator</a></span>
      should be used instead.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The ability to unbind <var class="varname">this</var> from closures that were created from a method,
      using <span class="methodname"><a href="closure.fromcallable.html" class="methodname">Closure::fromCallable()</a></span> or
      <span class="methodname"><a href="reflectionmethod.getclosure.html" class="methodname">ReflectionMethod::getClosure()</a></span>, has been removed.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The ability to unbind <var class="varname">this</var> from proper closures that contain uses of
      <var class="varname">this</var> has also been removed.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The ability to use <span class="function"><a href="function.array-key-exists.html" class="function">array_key_exists()</a></span> with objects has been removed.
      <span class="function"><a href="function.isset.html" class="function">isset()</a></span> or <span class="function"><a href="function.property-exists.html" class="function">property_exists()</a></span> may be used instead.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The behavior of <span class="function"><a href="function.array-key-exists.html" class="function">array_key_exists()</a></span> regarding the type of the
      <code class="parameter">key</code> parameter has been made consistent with <span class="function"><a href="function.isset.html" class="function">isset()</a></span> and
      normal array access. All key types now use the usual coercions and array/object keys throw a
      <span class="classname"><a href="class.typeerror.html" class="classname">TypeError</a></span>.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Any array that has a number <span class="replaceable">n</span> as its first numeric key will use
      <span class="replaceable">n+1</span> for its next implicit key, even if <span class="replaceable">n</span> is
      negative.
      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The default error_reporting level is now <strong><code>E_ALL</code></strong>. Previously it excluded
      <strong><code>E_NOTICE</code></strong> and <strong><code>E_DEPRECATED</code></strong>.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      <a href="errorfunc.configuration.html#ini.display-startup-errors" class="link">display_startup_errors</a> is now enabled by
      default.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Using <span class="type"><span class="type parent">parent</span></span> inside a class that has no parent will now result in a fatal
      compile-time error.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The <code class="literal">@</code> operator will no longer silence fatal errors
      (<strong><code>E_ERROR</code></strong>, <strong><code>E_CORE_ERROR</code></strong>,
      <strong><code>E_COMPILE_ERROR</code></strong>, <strong><code>E_USER_ERROR</code></strong>,
      <strong><code>E_RECOVERABLE_ERROR</code></strong>, <strong><code>E_PARSE</code></strong>). Error handlers that
      expect error_reporting to be <code class="literal">0</code> when <code class="literal">@</code> is used, should be
      adjusted to use a mask check instead:
     </p>
     <p class="para">
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Replace<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">my_error_handler</span><span style="color: #007700">(</span><span style="color: #0000BB">$err_no</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$err_msg</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$filename</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$linenum</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">error_reporting</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;...<br /></span><span style="color: #007700">}<br /><br /></span><span style="color: #FF8000">//&nbsp;With<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">my_error_handler</span><span style="color: #007700">(</span><span style="color: #0000BB">$err_no</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$err_msg</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$filename</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$linenum</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!(</span><span style="color: #0000BB">error_reporting</span><span style="color: #007700">()&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">$err_no</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;...<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
      </div>

     </p>
     <p class="para">
      Additionally, care should be taken that error messages are not displayed in production
      environments, which can result in information leaks. Please ensure that
      <code class="code">display_errors=Off</code> is used in conjunction with error logging.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      <code class="literal">#[</code> is no longer interpreted as the start of a comment,
      as this syntax is now used for attributes.
      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Inheritance errors due to incompatible method signatures (LSP violations) will now always
      generate a fatal error. Previously a warning was generated in some cases.
      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The precedence of the concatenation operator has changed relative to bitshifts and addition as
      well as subtraction.
     </p>
     <p class="para">
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"Sum:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$a&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">//&nbsp;was&nbsp;previously&nbsp;interpreted&nbsp;as:<br /></span><span style="color: #007700">echo&nbsp;(</span><span style="color: #DD0000">"Sum:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$a</span><span style="color: #007700">)&nbsp;+&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">//&nbsp;is&nbsp;now&nbsp;interpreted&nbsp;as:<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"Sum:"&nbsp;</span><span style="color: #007700">.&nbsp;(</span><span style="color: #0000BB">$a&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
      </div>

      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Arguments with a default value that resolves to <strong><code>null</code></strong> at runtime will no longer implicitly mark
      the argument type as nullable. Either an explicit nullable type, or an explicit <strong><code>null</code></strong> default
      value has to be used instead.
     </p>
     <p class="para">
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Replace<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">test</span><span style="color: #007700">(</span><span style="color: #0000BB">int&nbsp;$arg&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CONST_RESOLVING_TO_NULL</span><span style="color: #007700">)&nbsp;{}<br /></span><span style="color: #FF8000">//&nbsp;With<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">test</span><span style="color: #007700">(?</span><span style="color: #0000BB">int&nbsp;$arg&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">CONST_RESOLVING_TO_NULL</span><span style="color: #007700">)&nbsp;{}<br /></span><span style="color: #FF8000">//&nbsp;Or<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">test</span><span style="color: #007700">(</span><span style="color: #0000BB">int&nbsp;$arg&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span><span style="color: #007700">)&nbsp;{}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
      </div>

     </p>
    </li>
    <li class="listitem">
     <p class="para">
      A number of warnings have been converted into <span class="classname"><a href="class.error.html" class="classname">Error</a></span> exceptions:
     </p>
     <p class="para">
      <ul class="simplelist">
       <li class="member">
        Attempting to write to a property of a non-object. Previously this
        implicitly created an stdClass object for null, false and empty strings.
       </li>
       <li class="member">
        Attempting to append an element to an array for which the PHP_INT_MAX key
        is already used.
       </li>
       <li class="member">
        Attempting to use an invalid type (array or object) as an array key or
        string offset.
       </li>
       <li class="member">Attempting to write to an array index of a scalar value.</li>
       <li class="member">Attempting to unpack a non-array/Traversable.</li>
       <li class="member">
        Attempting to access unqualified constants which are undefined.
        Previously, unqualified constant accesses resulted in a warning and were interpreted as strings.
       </li>
      </ul>
     </p>
     <p class="para">
      A number of notices have been converted into warnings:
     </p>
     <p class="para">
      <ul class="simplelist">
       <li class="member">Attempting to read an undefined variable.</li>
       <li class="member">Attempting to read an undefined property.</li>
       <li class="member">Attempting to read an undefined array key.</li>
       <li class="member">Attempting to read a property of a non-object.</li>
       <li class="member">Attempting to access an array index of a non-array.</li>
       <li class="member">Attempting to convert an array to string.</li>
       <li class="member">Attempting to use a resource as an array key.</li>
       <li class="member">Attempting to use null, a boolean, or a float as a string offset.</li>
       <li class="member">Attempting to read an out-of-bounds string offset.</li>
       <li class="member">Attempting to assign an empty string to a string offset.</li>
      </ul>
      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Attempting to assign multiple bytes to a string offset will now emit a warning.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Unexpected characters in source files (such as NUL bytes outside of strings) will now result in a
      <span class="classname"><a href="class.parseerror.html" class="classname">ParseError</a></span> exception instead of a compile warning.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Uncaught exceptions now go through &quot;clean shutdown&quot;, which means that destructors will be called
      after an uncaught exception.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The compile time fatal error &quot;Only variables can be passed by reference&quot; has been delayed until
      runtime, and converted into an &quot;Argument cannot be passed by reference&quot;
      <span class="classname"><a href="class.error.html" class="classname">Error</a></span> exception.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Some &quot;Only variables should be passed by reference&quot; notices have been converted to &quot;Argument
      cannot be passed by reference&quot; exception.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The generated name for anonymous classes has changed. It will now include the name of the first
      parent or interface:
     </p>
     <p class="para">
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">new&nbsp;class&nbsp;extends&nbsp;</span><span style="color: #0000BB">ParentClass&nbsp;</span><span style="color: #007700">{};<br /></span><span style="color: #FF8000">//&nbsp;-&gt;&nbsp;ParentClass@anonymous<br /></span><span style="color: #007700">new&nbsp;class&nbsp;implements&nbsp;</span><span style="color: #0000BB">FirstInterface</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SecondInterface&nbsp;</span><span style="color: #007700">{};<br /></span><span style="color: #FF8000">//&nbsp;-&gt;&nbsp;FirstInterface@anonymous<br /></span><span style="color: #007700">new&nbsp;class&nbsp;{};<br /></span><span style="color: #FF8000">//&nbsp;-&gt;&nbsp;class@anonymous<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
      </div>

     </p>
     <p class="para">
      The name shown above is still followed by a NUL byte and a unique suffix.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Non-absolute trait method references in trait alias adaptations are now required to be
      unambiguous:
     </p>
     <p class="para">
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">X&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;use&nbsp;</span><span style="color: #0000BB">T1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">T2&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">func&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">otherFunc</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;</span><span style="color: #0000BB">func</span><span style="color: #007700">()&nbsp;{}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
      </div>

     </p>
     <p class="para">
      If both <code class="code">T1::func()</code> and <code class="code">T2::func()</code> exist, this code was previously
      silently accepted, and func was assumed to refer to <code class="code">T1::func</code>. Now it will generate a
      fatal error instead, and either <code class="code">T1::func</code> or <code class="code">T2::func</code> needs to be
      written explicitly.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The signature of abstract methods defined in traits is now checked against the implementing class
      method:
     </p>
     <p class="para">
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">trait&nbsp;</span><span style="color: #0000BB">MyTrait&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;abstract&nbsp;private&nbsp;function&nbsp;</span><span style="color: #0000BB">neededByTrait</span><span style="color: #007700">():&nbsp;</span><span style="color: #0000BB">string</span><span style="color: #007700">;<br />}<br /><br />class&nbsp;</span><span style="color: #0000BB">MyClass&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;use&nbsp;</span><span style="color: #0000BB">MyTrait</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Error,&nbsp;because&nbsp;of&nbsp;return&nbsp;type&nbsp;mismatch.<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">neededByTrait</span><span style="color: #007700">():&nbsp;</span><span style="color: #0000BB">int&nbsp;</span><span style="color: #007700">{&nbsp;return&nbsp;</span><span style="color: #0000BB">42</span><span style="color: #007700">;&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
      </div>

      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Disabled functions are now treated exactly like non-existent functions. Calling a disabled
      function will report it as unknown, and redefining a disabled function is now possible.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      <code class="literal">data://</code> stream wrappers are no longer writable, which matches the documented
      behavior.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      The arithmetic and bitwise operators <code class="literal">+</code>, <code class="literal">-</code>,
      <code class="literal">*</code>, <code class="literal">/</code>, <code class="literal">**</code>, <code class="literal">%</code>,
      <code class="literal">&lt;&lt;</code>, <code class="literal">&gt;&gt;</code>, <code class="literal">&amp;</code>,
      <code class="literal">|</code>, <code class="literal">^</code>, <code class="literal">~</code>, <code class="literal">++</code>,
      <code class="literal">--</code> will now consistently throw a <span class="classname"><a href="class.typeerror.html" class="classname">TypeError</a></span> when one of
      the operands is an <span class="type">array</span>, <a href="language.types.resource.html" class="link">资源(resource)</a> or non-overloaded <span class="type">object</span>. The only exception to this is
      the array <code class="literal">+</code> array merge operation, which remains supported.
      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Float to string casting will now always behave locale-independently.
     </p>
     <p class="para">
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />setlocale</span><span style="color: #007700">(</span><span style="color: #0000BB">LC_ALL</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"de_DE"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$f&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">3.14</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">$f</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">//&nbsp;Previously:&nbsp;3,14<br />//&nbsp;Now:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.14<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
      </div>

     </p>
     <p class="para">
      See <span class="function"><a href="function.printf.html" class="function">printf()</a></span>, <span class="function"><a href="function.number-format.html" class="function">number_format()</a></span> and
      <span class="methodname"><strong>NumberFormatter()</strong></span> for ways to customize number formatting.
      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Support for deprecated curly braces for offset access has been removed.
     </p>
     <p class="para">
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Instead&nbsp;of:<br /></span><span style="color: #0000BB">$array</span><span style="color: #007700">{</span><span style="color: #0000BB">0</span><span style="color: #007700">};<br /></span><span style="color: #0000BB">$array</span><span style="color: #007700">{</span><span style="color: #DD0000">"key"</span><span style="color: #007700">};<br /></span><span style="color: #FF8000">//&nbsp;Write:<br /></span><span style="color: #0000BB">$array</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">];<br /></span><span style="color: #0000BB">$array</span><span style="color: #007700">[</span><span style="color: #DD0000">"key"</span><span style="color: #007700">];<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
      </div>

      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Applying the final modifier on a private method will now produce a warning unless that method is
      the constructor.
      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      If an object constructor <span class="function"><a href="function.exit.html" class="function">exit()</a></span>s, the object destructor will no longer be
      called. This matches the behavior when the constructor throws.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Namespaced names can no longer contain whitespace: While <code class="code">Foo\Bar</code> will be recognized
      as a namespaced name, <code class="code">Foo \ Bar</code> will not. Conversely, reserved keywords are now
      permitted as namespace segments, which may also change the interpretation of code:
      <code class="code">new\x</code> is now the same as <code class="code">constant(&#039;new\x&#039;)</code>, not
      <code class="code">new \x()</code>.
      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Nested ternaries now require explicit parentheses.
      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      <span class="function"><a href="function.debug-backtrace.html" class="function">debug_backtrace()</a></span> and <span class="methodname"><a href="exception.gettrace.html" class="methodname">Exception::getTrace()</a></span> will no
      longer provide references to arguments. It will not be possible to change function arguments
      through the backtrace.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Numeric string handling has been altered to be more intuitive and less error-prone. Trailing
      whitespace is now allowed in numeric strings for consistency with how leading whitespace is
      treated. This mostly affects:
     </p>
     <p class="para">
      <ul class="simplelist">
       <li class="member">The <span class="function"><a href="function.is-numeric.html" class="function">is_numeric()</a></span> function</li>
       <li class="member">String-to-string comparisons</li>
       <li class="member">Type declarations</li>
       <li class="member">Increment and decrement operations</li>
      </ul>
     </p>
     <p class="para">
      The concept of a &quot;leading-numeric string&quot; has been mostly dropped; the cases where this remains
      exist in order to ease migration. Strings which emitted an <strong><code>E_NOTICE</code></strong> &quot;A non
      well-formed numeric value encountered&quot; will now emit an <strong><code>E_WARNING</code></strong> &quot;A
      non-numeric value encountered&quot; and all strings which emitted an <strong><code>E_WARNING</code></strong> &quot;A
      non-numeric value encountered&quot; will now throw a
      <span class="classname"><a href="class.typeerror.html" class="classname">TypeError</a></span>. This mostly affects:
     </p>
     <p class="para">
      <ul class="simplelist">
       <li class="member">Arithmetic operations</li>
       <li class="member">Bitwise operations</li>
      </ul>
     </p>
     <p class="para">
      This <strong><code>E_WARNING</code></strong> to <span class="classname"><a href="class.typeerror.html" class="classname">TypeError</a></span> change also affects the
      <strong><code>E_WARNING</code></strong> &quot;Illegal string offset &#039;string&#039;&quot; for illegal string offsets. The
      behavior of explicit casts to int/float from strings has not been changed.
      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Magic Methods will now have their arguments and return types checked if they have them declared.
      The signatures should match the following list:
     </p>
     <p class="para">
      <ul class="simplelist">
       <li class="member"><code class="code">__call(string $name, array $arguments): mixed</code></li>
       <li class="member"><code class="code">__callStatic(string $name, array $arguments): mixed</code></li>
       <li class="member"><code class="code">__clone(): void</code></li>
       <li class="member"><code class="code">__debugInfo(): ?array</code></li>
       <li class="member"><code class="code">__get(string $name): mixed</code></li>
       <li class="member"><code class="code">__invoke(mixed $arguments): mixed</code></li>
       <li class="member"><code class="code">__isset(string $name): bool</code></li>
       <li class="member"><code class="code">__serialize(): array</code></li>
       <li class="member"><code class="code">__set(string $name, mixed $value): void</code></li>
       <li class="member"><code class="code">__set_state(array $properties): object</code></li>
       <li class="member"><code class="code">__sleep(): array</code></li>
       <li class="member"><code class="code">__unserialize(array $data): void</code></li>
       <li class="member"><code class="code">__unset(string $name): void</code></li>
       <li class="member"><code class="code">__wakeup(): void</code></li>
      </ul>
      
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      <span class="function"><a href="function.call-user-func-array.html" class="function">call_user_func_array()</a></span> array keys will now be interpreted as parameter names,
      instead of being silently ignored.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Declaring a function called <code class="literal">assert()</code> inside a namespace is
      no longer allowed, and issues <strong><code>E_COMPILE_ERROR</code></strong>.
      The <span class="function"><a href="function.assert.html" class="function">assert()</a></span> function is subject to special handling by the engine,
      which may lead to inconsistent behavior when defining a namespaced function with the same name.
     </p>
    </li>
   </ul>
  </div>
 </div>

 <div class="sect2" id="migration80.incompatible.resource2object">
  <h3 class="title">Resource to Object Migration</h3>

  <p class="para">
   Several <a href="language.types.resource.html" class="link">资源(resource)</a>s have been migrated to <span class="type">object</span>s.
   Return value checks using <span class="function"><a href="function.is-resource.html" class="function">is_resource()</a></span> should be replaced with checks for <strong><code>false</code></strong>.
  </p>
  <ul class="itemizedlist">
    <li class="listitem">
     <p class="para">
      <span class="function"><a href="function.curl-init.html" class="function">curl_init()</a></span> will now return a <span class="classname"><a href="class.curlhandle.html" class="classname">CurlHandle</a></span> object rather
      than a <a href="language.types.resource.html" class="link">资源(resource)</a>. The <span class="function"><a href="function.curl-close.html" class="function">curl_close()</a></span> function no longer has an effect,
      instead the <span class="classname"><a href="class.curlhandle.html" class="classname">CurlHandle</a></span> instance is automatically destroyed if it is no
      longer referenced.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      <span class="function"><a href="function.curl-multi-init.html" class="function">curl_multi_init()</a></span> will now return a <span class="classname"><a href="class.curlmultihandle.html" class="classname">CurlMultiHandle</a></span>
      object rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>. The <span class="function"><a href="function.curl-multi-close.html" class="function">curl_multi_close()</a></span> function no
      longer has an effect, instead the <span class="classname"><a href="class.curlmultihandle.html" class="classname">CurlMultiHandle</a></span> instance is
      automatically destroyed if it is no longer referenced.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      <span class="function"><a href="function.curl-share-init.html" class="function">curl_share_init()</a></span> will now return a <span class="classname"><a href="class.curlsharehandle.html" class="classname">CurlShareHandle</a></span>
      object rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>. The <span class="function"><a href="function.curl-share-close.html" class="function">curl_share_close()</a></span> function no
      longer has an effect, instead the <span class="classname"><a href="class.curlsharehandle.html" class="classname">CurlShareHandle</a></span> instance is
      automatically destroyed if it is no longer referenced.
     </p>
    </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.enchant-broker-init.html" class="function">enchant_broker_init()</a></span> will now return an <span class="classname"><a href="class.enchantbroker.html" class="classname">EnchantBroker</a></span>
     object rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.enchant-broker-request-dict.html" class="function">enchant_broker_request_dict()</a></span> and
     <span class="function"><a href="function.enchant-broker-request-pwl-dict.html" class="function">enchant_broker_request_pwl_dict()</a></span> will now return an
     <span class="classname"><a href="class.enchantdictionary.html" class="classname">EnchantDictionary</a></span> object rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The GD extension now uses <span class="classname"><a href="class.gdimage.html" class="classname">GdImage</a></span> objects as the underlying data structure
     for images, rather than <a href="language.types.resource.html" class="link">资源(resource)</a>s.
     The <span class="function"><a href="function.imagedestroy.html" class="function">imagedestroy()</a></span> function no longer has an effect; instead the
     <span class="classname"><a href="class.gdimage.html" class="classname">GdImage</a></span> instance is automatically destroyed if it is no longer referenced.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.openssl-x509-read.html" class="function">openssl_x509_read()</a></span> and <span class="function"><a href="function.openssl-csr-sign.html" class="function">openssl_csr_sign()</a></span> will now return
     an <span class="classname"><a href="class.opensslcertificate.html" class="classname">OpenSSLCertificate</a></span> object rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>.
     The <span class="function"><a href="function.openssl-x509-free.html" class="function">openssl_x509_free()</a></span> function is deprecated and no longer has an effect,
     instead the <span class="classname"><a href="class.opensslcertificate.html" class="classname">OpenSSLCertificate</a></span> instance is automatically destroyed if it
     is no longer referenced.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.openssl-csr-new.html" class="function">openssl_csr_new()</a></span> will now return an
     <span class="classname"><a href="class.opensslcertificatesigningrequest.html" class="classname">OpenSSLCertificateSigningRequest</a></span> object rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.openssl-pkey-new.html" class="function">openssl_pkey_new()</a></span> will now return an
     <span class="classname"><a href="class.opensslasymmetrickey.html" class="classname">OpenSSLAsymmetricKey</a></span> object rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>.
     The <span class="function"><a href="function.openssl-pkey-free.html" class="function">openssl_pkey_free()</a></span> function is deprecated and no longer has an effect,
     instead the <span class="classname"><a href="class.opensslasymmetrickey.html" class="classname">OpenSSLAsymmetricKey</a></span> instance is automatically destroyed if it
     is no longer referenced.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.shmop-open.html" class="function">shmop_open()</a></span> 现在将返回 <span class="classname"><a href="class.shmop.html" class="classname">Shmop</a></span> 对象而不是
     <a href="language.types.resource.html" class="link">资源(resource)</a>。<span class="function"><a href="function.shmop-close.html" class="function">shmop_close()</a></span> 函数将不再有效，已弃用；如果不在引用 
     <span class="classname"><a href="class.shmop.html" class="classname">Shmop</a></span> 实例，其将会自动销毁。
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.socket-create.html" class="function">socket_create()</a></span>, <span class="function"><a href="function.socket-create-listen.html" class="function">socket_create_listen()</a></span>,
     <span class="function"><a href="function.socket-accept.html" class="function">socket_accept()</a></span>, <span class="function"><a href="function.socket-import-stream.html" class="function">socket_import_stream()</a></span>,
     <span class="function"><a href="function.socket-addrinfo-connect.html" class="function">socket_addrinfo_connect()</a></span>, <span class="function"><a href="function.socket-addrinfo-bind.html" class="function">socket_addrinfo_bind()</a></span>, and
     <span class="function"><a href="function.socket-wsaprotocol-info-import.html" class="function">socket_wsaprotocol_info_import()</a></span> will now return a
     <span class="classname"><a href="class.socket.html" class="classname">Socket</a></span> object rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>.
     <span class="function"><a href="function.socket-addrinfo-lookup.html" class="function">socket_addrinfo_lookup()</a></span> will now return an array of
     <span class="classname"><a href="class.addressinfo.html" class="classname">AddressInfo</a></span> objects rather than <a href="language.types.resource.html" class="link">资源(resource)</a>s.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.msg-get-queue.html" class="function">msg_get_queue()</a></span> will now return an <span class="classname"><a href="class.sysvmessagequeue.html" class="classname">SysvMessageQueue</a></span>
     object rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.sem-get.html" class="function">sem_get()</a></span> will now return an <span class="classname"><a href="class.sysvsemaphore.html" class="classname">SysvSemaphore</a></span> object
     rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.shm-attach.html" class="function">shm_attach()</a></span> will now return an <span class="classname"><a href="class.sysvsharedmemory.html" class="classname">SysvSharedMemory</a></span> object
     rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.xml-parser-create.html" class="function">xml_parser_create()</a></span> and <span class="function"><a href="function.xml-parser-create-ns.html" class="function">xml_parser_create_ns()</a></span> will now
     return an <span class="classname"><a href="class.xmlparser.html" class="classname">XMLParser</a></span> object rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>. The
     <span class="function"><a href="function.xml-parser-free.html" class="function">xml_parser_free()</a></span> function no longer has an effect, instead the XmlParser
     instance is automatically destroyed if it is no longer referenced.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <a href="book.xmlwriter.html" class="link">XMLWriter</a> functions now accept and return, respectively,
     <span class="classname"><a href="class.xmlwriter.html" class="classname">XMLWriter</a></span> objects instead of <a href="language.types.resource.html" class="link">资源(resource)</a>s.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.inflate-init.html" class="function">inflate_init()</a></span> will now return an <span class="classname"><a href="class.inflatecontext.html" class="classname">InflateContext</a></span> object
     rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.deflate-init.html" class="function">deflate_init()</a></span> will now return a <span class="classname"><a href="class.deflatecontext.html" class="classname">DeflateContext</a></span> object
     rather than a <a href="language.types.resource.html" class="link">资源(resource)</a>.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.com">
  <h3 class="title">COM and .Net (Windows)</h3>

  <p class="para">
   The ability to import case-insensitive constants from type libraries has been removed.
   The second argument to <span class="function"><a href="function.com-load-typelib.html" class="function">com_load_typelib()</a></span> may no longer be false;
   <a href="com.configuration.html#ini.com.autoregister-casesensitive" class="link">com.autoregister_casesensitive</a>
   may no longer be disabled; case-insensitive markers in
   <a href="com.configuration.html#ini.com.typelib-file" class="link">com.typelib_file</a> are ignored.
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.curl">
  <h3 class="title">CURL</h3>

  <p class="para">
   <strong><code>CURLOPT_POSTFIELDS</code></strong> no longer accepts objects as arrays. To
   interpret an object as an array, perform an explicit <code class="code">(array)</code> cast. The
   same applies to other options accepting arrays as well.
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.datetime">
  <h3 class="title">Date and Time</h3>

  <p class="para">
   <span class="function"><a href="function.mktime.html" class="function">mktime()</a></span> and <span class="function"><a href="function.gmmktime.html" class="function">gmmktime()</a></span> now require at least one
   argument. <span class="function"><a href="function.time.html" class="function">time()</a></span> can be used to get the current timestamp.
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.dom">
  <h3 class="title">DOM</h3>

  <p class="para">
   Unimplemented classes from the DOM extension that had no behavior and contained test
   data have been removed. These classes have also been removed in the latest version of
   the DOM standard:
  </p>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="classname"><strong class="classname">DOMNameList</strong></span></li>
    <li class="member"><span class="classname"><strong class="classname">DomImplementationList</strong></span></li>
    <li class="member"><span class="classname"><strong class="classname">DOMConfiguration</strong></span></li>
    <li class="member"><span class="classname"><strong class="classname">DomError</strong></span></li>
    <li class="member"><span class="classname"><strong class="classname">DomErrorHandler</strong></span></li>
    <li class="member"><span class="classname"><strong class="classname">DOMImplementationSource</strong></span></li>
    <li class="member"><span class="classname"><strong class="classname">DOMLocator</strong></span></li>
    <li class="member"><span class="classname"><strong class="classname">DOMUserDataHandler</strong></span></li>
    <li class="member"><span class="classname"><strong class="classname">DOMTypeInfo</strong></span></li>
    <li class="member"><span class="classname"><strong class="classname">DOMStringExtend</strong></span></li>
   </ul>
  </p>
  <p class="para">
   DOM 扩展中没有实现行为的方法已被删除：
  </p>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><strong>DOMNamedNodeMap::setNamedItem()</strong></span></li>
    <li class="member"><span class="methodname"><strong>DOMNamedNodeMap::removeNamedItem()</strong></span></li>
    <li class="member"><span class="methodname"><strong>DOMNamedNodeMap::setNamedItemNS()</strong></span></li>
    <li class="member"><span class="methodname"><strong>DOMNamedNodeMap::removeNamedItemNS()</strong></span></li>
    <li class="member"><span class="methodname"><strong>DOMText::replaceWholeText()</strong></span></li>
    <li class="member"><span class="methodname"><strong>DOMNode::compareDocumentPosition()</strong></span></li>
    <li class="member"><span class="methodname"><strong>DOMNode::isEqualNode()</strong></span></li>
    <li class="member"><span class="methodname"><strong>DOMNode::getFeature()</strong></span></li>
    <li class="member"><span class="methodname"><strong>DOMNode::setUserData()</strong></span></li>
    <li class="member"><span class="methodname"><strong>DOMNode::getUserData()</strong></span></li>
    <li class="member"><span class="methodname"><strong>DOMDocument::renameNode()</strong></span></li>
   </ul>
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.enchant">
  <h3 class="title">Enchant</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.enchant-broker-list-dicts.html" class="function">enchant_broker_list_dicts()</a></span>, <span class="function"><a href="function.enchant-broker-describe.html" class="function">enchant_broker_describe()</a></span> and
     <span class="function"><a href="function.enchant-dict-suggest.html" class="function">enchant_dict_suggest()</a></span> will now return an empty array instead of <strong><code>null</code></strong>.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.exif">
  <h3 class="title">Exif</h3>

  <p class="para">
   <span class="function"><a href="function.read-exif-data.html" class="function">read_exif_data()</a></span> has been removed; <span class="function"><a href="function.exif-read-data.html" class="function">exif_read_data()</a></span>
   should be used instead.
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.filter">
  <h3 class="title">Filter</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     The <strong><code>FILTER_FLAG_SCHEME_REQUIRED</code></strong> and
     <strong><code>FILTER_FLAG_HOST_REQUIRED</code></strong> flags for the
     <strong><code>FILTER_VALIDATE_URL</code></strong> filter have been removed. The <code class="literal">scheme</code>
     and <code class="literal">host</code> are (and have been) always required.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <strong><code>INPUT_REQUEST</code></strong> and <strong><code>INPUT_SESSION</code></strong> source for
     <span class="function"><a href="function.filter-input.html" class="function">filter_input()</a></span> etc. have been removed. These were never implemented and their
     use always generated a warning.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.gd">
  <h3 class="title">GD</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     移除弃用函数 <span class="function"><a href="function.image2wbmp.html" class="function">image2wbmp()</a></span>。
     
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     移除弃用函数 <span class="function"><a href="function.png2wbmp.html" class="function">png2wbmp()</a></span> 和 <span class="function"><a href="function.jpeg2wbmp.html" class="function">jpeg2wbmp()</a></span>。
     
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The default <code class="parameter">mode</code> parameter of <span class="function"><a href="function.imagecropauto.html" class="function">imagecropauto()</a></span> no longer
     accepts <code class="literal">-1</code>. <strong><code>IMG_CROP_DEFAULT</code></strong> should be used instead.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     On Windows, <var class="filename">php_gd2.dll</var> has been renamed to <var class="filename">php_gd.dll</var>.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.gmp">
  <h3 class="title">GMP</h3>

  <p class="para">
   <span class="function"><a href="function.gmp-random.html" class="function">gmp_random()</a></span> has been removed. One of <span class="function"><a href="function.gmp-random-range.html" class="function">gmp_random_range()</a></span> or
   <span class="function"><a href="function.gmp-random-bits.html" class="function">gmp_random_bits()</a></span> should be used instead.
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.iconv">
  <h3 class="title">Iconv</h3>

  <p class="para">
   iconv implementations which do not properly set <var class="varname">errno</var> in case of errors are no
   longer supported.
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.imap">
  <h3 class="title">IMAP</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     The unused <code class="parameter">default_host</code> argument of <span class="function"><a href="function.imap-headerinfo.html" class="function">imap_headerinfo()</a></span>
     has been removed.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <span class="function"><a href="function.imap-header.html" class="function">imap_header()</a></span> function which is an alias of
     <span class="function"><a href="function.imap-headerinfo.html" class="function">imap_headerinfo()</a></span> has been removed.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.intl">
  <h3 class="title">Internationalization Functions</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     The deprecated constant <strong><code>INTL_IDNA_VARIANT_2003</code></strong> has been removed.
     
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     移除弃用常量 <strong><code>Normalizer::NONE</code></strong>。
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.ldap">
  <h3 class="title">LDAP</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     移除弃用函数 <span class="function"><a href="function.ldap-sort.html" class="function">ldap_sort()</a></span>、<span class="function"><a href="function.ldap-control-paged-result.html" class="function">ldap_control_paged_result()</a></span>
     和 <span class="function"><a href="function.ldap-control-paged-result-response.html" class="function">ldap_control_paged_result_response()</a></span>。
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.ldap-set-rebind-proc.html" class="function">ldap_set_rebind_proc()</a></span> 的接口已修改；<code class="parameter">callback</code>
     不再接受空字符串；应该使用 <strong><code>null</code></strong> 代替。
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.mbstring">
  <h3 class="title">MBString</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     The <a href="mbstring.configuration.html#ini.mbstring.func-overload" class="link">mbstring.func_overload</a> directive has been
     removed. The related <strong><code>MB_OVERLOAD_MAIL</code></strong>,
     <strong><code>MB_OVERLOAD_STRING</code></strong>, and <strong><code>MB_OVERLOAD_REGEX</code></strong> constants
     have also been removed. Finally, the <code class="literal">&quot;func_overload&quot;</code> and
     <code class="literal">&quot;func_overload_list&quot;</code> entries in <span class="function"><a href="function.mb-get-info.html" class="function">mb_get_info()</a></span> have been
     removed.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.mb-parse-str.html" class="function">mb_parse_str()</a></span> can no longer be used without specifying a result array.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     A number of deprecated mbregex aliases have been removed. See the following
     list for which functions should be used instead:
    </p>
    <p class="para">
     <ul class="simplelist">
      <li class="member"><span class="function"><strong>mbregex_encoding()</strong></span> → <span class="function"><a href="function.mb-regex-encoding.html" class="function">mb_regex_encoding()</a></span></li>
      <li class="member"><span class="function"><strong>mbereg()</strong></span> → <span class="function"><a href="function.mb-ereg.html" class="function">mb_ereg()</a></span></li>
      <li class="member"><span class="function"><strong>mberegi()</strong></span> → <span class="function"><a href="function.mb-eregi.html" class="function">mb_eregi()</a></span></li>
      <li class="member"><span class="function"><strong>mbereg_replace()</strong></span> → <span class="function"><a href="function.mb-ereg-replace.html" class="function">mb_ereg_replace()</a></span></li>
      <li class="member"><span class="function"><strong>mberegi_replace()</strong></span> → <span class="function"><a href="function.mb-eregi-replace.html" class="function">mb_eregi_replace()</a></span></li>
      <li class="member"><span class="function"><strong>mbsplit()</strong></span> → <span class="function"><a href="function.mb-split.html" class="function">mb_split()</a></span></li>
      <li class="member"><span class="function"><strong>mbereg_match()</strong></span> → <span class="function"><a href="function.mb-ereg-match.html" class="function">mb_ereg_match()</a></span></li>
      <li class="member"><span class="function"><strong>mbereg_search()</strong></span> → <span class="function"><a href="function.mb-ereg-search.html" class="function">mb_ereg_search()</a></span></li>
      <li class="member"><span class="function"><strong>mbereg_search_pos()</strong></span> → <span class="function"><a href="function.mb-ereg-search-pos.html" class="function">mb_ereg_search_pos()</a></span></li>
      <li class="member"><span class="function"><strong>mbereg_search_regs()</strong></span> → <span class="function"><a href="function.mb-ereg-search-regs.html" class="function">mb_ereg_search_regs()</a></span></li>
      <li class="member"><span class="function"><strong>mbereg_search_init()</strong></span> → <span class="function"><a href="function.mb-ereg-search-init.html" class="function">mb_ereg_search_init()</a></span></li>
      <li class="member"><span class="function"><strong>mbereg_search_getregs()</strong></span> → <span class="function"><a href="function.mb-ereg-search-getregs.html" class="function">mb_ereg_search_getregs()</a></span></li>
      <li class="member"><span class="function"><strong>mbereg_search_getpos()</strong></span> → <span class="function"><a href="function.mb-ereg-search-getpos.html" class="function">mb_ereg_search_getpos()</a></span></li>
      <li class="member"><span class="function"><strong>mbereg_search_setpos()</strong></span> → <span class="function"><a href="function.mb-ereg-search-setpos.html" class="function">mb_ereg_search_setpos()</a></span></li>
     </ul>
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <code class="literal">e</code> modifier for <span class="function"><a href="function.mb-ereg-replace.html" class="function">mb_ereg_replace()</a></span> has been removed.
     <span class="function"><a href="function.mb-ereg-replace-callback.html" class="function">mb_ereg_replace_callback()</a></span> should be used instead.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     A non-string pattern argument to <span class="function"><a href="function.mb-ereg-replace.html" class="function">mb_ereg_replace()</a></span> will now be interpreted as
     a string instead of an ASCII codepoint. The previous behavior may be restored with an explicit
     call to <span class="function"><a href="function.chr.html" class="function">chr()</a></span>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <code class="parameter">needle</code> argument for <span class="function"><a href="function.mb-strpos.html" class="function">mb_strpos()</a></span>,
     <span class="function"><a href="function.mb-strrpos.html" class="function">mb_strrpos()</a></span>, <span class="function"><a href="function.mb-stripos.html" class="function">mb_stripos()</a></span>,
     <span class="function"><a href="function.mb-strripos.html" class="function">mb_strripos()</a></span>, <span class="function"><a href="function.mb-strstr.html" class="function">mb_strstr()</a></span>,
     <span class="function"><a href="function.mb-stristr.html" class="function">mb_stristr()</a></span>, <span class="function"><a href="function.mb-strrchr.html" class="function">mb_strrchr()</a></span> and
     <span class="function"><a href="function.mb-strrichr.html" class="function">mb_strrichr()</a></span> can now be empty.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <code class="parameter">is_hex</code> parameter, which was not used internally, has been removed from
     <span class="function"><a href="function.mb-decode-numericentity.html" class="function">mb_decode_numericentity()</a></span>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The legacy behavior of passing the encoding as the third argument instead of an offset for the
     <span class="function"><a href="function.mb-strrpos.html" class="function">mb_strrpos()</a></span> function has been removed; an explicit <code class="literal">0</code>
     offset with the encoding should be provided as the fourth argument instead.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <code class="literal">ISO_8859-*</code> character encoding aliases have been replaced by
     <code class="literal">ISO8859-*</code> aliases for better interoperability with the iconv extension. The
     mbregex ISO 8859 aliases with underscores (<code class="literal">ISO_8859_*</code> and
     <code class="literal">ISO8859_*</code>) have also been removed.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.mb-ereg.html" class="function">mb_ereg()</a></span> and <span class="function"><a href="function.mb-eregi.html" class="function">mb_eregi()</a></span> will now return boolean <strong><code>true</code></strong> on
     a successful match. Previously they returned integer <code class="literal">1</code> if
     <code class="parameter">matches</code> was not passed, or <code class="code">max(1, strlen($matches[0]))</code> if
     <code class="parameter">matches</code> was passed.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.oci8">
  <h3 class="title">OCI8</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     The <span class="classname"><strong class="classname">OCI-Lob</strong></span> class is now called <span class="classname"><a href="class.ocilob.html" class="classname">OCILob</a></span>, and the
     <span class="classname"><strong class="classname">OCI-Collection</strong></span> class is now called <span class="classname"><a href="class.ocicollection.html" class="classname">OCICollection</a></span>
     for name compliance enforced by PHP 8 arginfo type annotation tooling.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     Several alias functions have been marked as deprecated.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.oci-internal-debug.html" class="function">oci_internal_debug()</a></span> and its alias <span class="function"><a href="function.ociinternaldebug.html" class="function">ociinternaldebug()</a></span> have
     been removed.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.odbc">
  <h3 class="title">ODBC</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.odbc-connect.html" class="function">odbc_connect()</a></span> no longer reuses connections.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The unused <code class="parameter">flags</code> parameter of <span class="function"><a href="function.odbc-exec.html" class="function">odbc_exec()</a></span> has been
     removed.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.openssl">
  <h3 class="title">OpenSSL</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.openssl-seal.html" class="function">openssl_seal()</a></span> and <span class="function"><a href="function.openssl-open.html" class="function">openssl_open()</a></span> now require
     <code class="parameter">method</code> to be passed, as the previous default of <code class="literal">&quot;RC4&quot;</code>
     is considered insecure.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.pcre">
  <h3 class="title">Regular Expressions (Perl-Compatible)</h3>

  <p class="para">
   When passing invalid escape sequences they are no longer interpreted as literals. This behavior
   previously required the <code class="literal">X</code> modifier – which is now ignored.
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.pdo">
  <h3 class="title">PHP Data Objects</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     The default error handling mode has been changed from &quot;silent&quot; to &quot;exceptions&quot;. See
     <a href="pdo.error-handling.html" class="link">Errors and error handling</a> for details.
     
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The signatures of some PDO methods have changed:
    </p>
    <p class="para">
     <ul class="simplelist">
      <li class="member"><code class="code">PDO::query(string $query, ?int $fetchMode  = null, mixed  ...$fetchModeArgs)</code></li>
      <li class="member"><code class="code">PDOStatement::setFetchMode(int $mode, mixed ...$args)</code></li>
     </ul>
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.pdo-odbc">
  <h3 class="title">PDO ODBC</h3>

  <p class="para">
   The <var class="filename">php.ini</var> directive
   <a href="ref.pdo-odbc.html#ini.pdo-odbc.db2-instance-name" class="link">pdo_odbc.db2_instance_name</a> has been
   removed.
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.pdo-mysql">
  <h3 class="title">PDO MySQL</h3>

  <p class="para">
   <span class="methodname"><a href="pdo.intransaction.html" class="methodname">PDO::inTransaction()</a></span> now reports the actual transaction state of
   the connection, rather than an approximation maintained by PDO. If a query that is
   subject to &quot;implicit commit&quot; is executed, <span class="methodname"><a href="pdo.intransaction.html" class="methodname">PDO::inTransaction()</a></span>
   will subsequently return <strong><code>false</code></strong>, as a transaction is no longer active.
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.pgsql">
  <h3 class="title">PostgreSQL</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     The deprecated <span class="function"><a href="function.pg-connect.html" class="function">pg_connect()</a></span> syntax using multiple parameters instead of a
     connection string is no longer supported.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The deprecated <span class="function"><a href="function.pg-lo-import.html" class="function">pg_lo_import()</a></span> and <span class="function"><a href="function.pg-lo-export.html" class="function">pg_lo_export()</a></span> signature
     that passes the connection as the last argument is no longer supported. The connection should be
     passed as first argument instead.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.pg-fetch-all.html" class="function">pg_fetch_all()</a></span> will now return an empty array instead of <strong><code>false</code></strong> for result
     sets with zero rows.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.phar">
  <h3 class="title">Phar</h3>

  <p class="para">
   Metadata associated with a phar will no longer be automatically unserialized, to fix potential
   security vulnerabilities due to object instantiation, autoloading, etc.
   
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.reflection">
  <h3 class="title">Reflection</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     The method signatures
    </p>
    <p class="para">
     <ul class="simplelist">
      <li class="member"><code class="code">ReflectionClass::newInstance($args)</code></li>
      <li class="member"><code class="code">ReflectionFunction::invoke($args)</code></li>
      <li class="member"><code class="code">ReflectionMethod::invoke($object, $args)</code></li>
     </ul>
    </p>
    <p class="para">
     have been changed to:
    </p>
    <p class="para">
     <ul class="simplelist">
      <li class="member"><code class="code">ReflectionClass::newInstance(...$args)</code></li>
      <li class="member"><code class="code">ReflectionFunction::invoke(...$args)</code></li>
      <li class="member"><code class="code">ReflectionMethod::invoke($object, ...$args)</code></li>
     </ul>
    </p>
    <p class="para">
     Code that must be compatible with both PHP 7 and PHP 8 can use the following
     signatures to be compatible with both versions:
    </p>
    <p class="para">
     <ul class="simplelist">
      <li class="member"><code class="code">ReflectionClass::newInstance($arg = null, ...$args)</code></li>
      <li class="member"><code class="code">ReflectionFunction::invoke($arg = null, ...$args)</code></li>
      <li class="member"><code class="code">ReflectionMethod::invoke($object, $arg = null, ...$args)</code></li>
     </ul>
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <span class="methodname"><a href="reflectiontype.tostring.html" class="methodname">ReflectionType::__toString()</a></span> method will now return a complete debug
     representation of the type, and is no longer deprecated. In particular the result will include a
     nullability indicator for nullable types. The format of the return value is not stable and may
     change between PHP versions.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     Reflection export() methods have been removed.
     Instead reflection objects can be cast to string.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="methodname"><a href="reflectionmethod.isconstructor.html" class="methodname">ReflectionMethod::isConstructor()</a></span> and
     <span class="methodname"><a href="reflectionmethod.isdestructor.html" class="methodname">ReflectionMethod::isDestructor()</a></span> now also return <strong><code>true</code></strong> for
     <a href="language.oop5.decon.html#object.construct" class="link">__construct()</a> and
     <a href="language.oop5.decon.html#object.destruct" class="link">__destruct()</a> methods of interfaces.
     Previously, this would only be true for methods of classes and traits.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="methodname"><strong>ReflectionType::isBuiltin()</strong></span> method has been moved to
     <span class="classname"><a href="class.reflectionnamedtype.html" class="classname">ReflectionNamedType</a></span>. <span class="classname"><a href="class.reflectionuniontype.html" class="classname">ReflectionUnionType</a></span> does not
     have it.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.sockets">
  <h3 class="title">Sockets</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     The deprecated <strong><code>AI_IDN_ALLOW_UNASSIGNED</code></strong> and
     <strong><code>AI_IDN_USE_STD3_ASCII_RULES</code></strong> <code class="parameter">flags</code> for
     <span class="function"><a href="function.socket-addrinfo-lookup.html" class="function">socket_addrinfo_lookup()</a></span> have been removed.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.spl">
  <h3 class="title">Standard PHP Library (SPL)</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     <span class="methodname"><a href="splfileobject.fgetss.html" class="methodname">SplFileObject::fgetss()</a></span> has been removed.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="methodname"><a href="splfileobject.seek.html" class="methodname">SplFileObject::seek()</a></span> 总是寻找到一行的开头。之前，位置 <code class="literal">&gt;=1</code>
     会搜索到下一行的开头。
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="methodname"><a href="splheap.compare.html" class="methodname">SplHeap::compare()</a></span> now specifies a method signature. Inheriting classes
     implementing this method will now have to use a compatible method signature.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="methodname"><a href="spldoublylinkedlist.push.html" class="methodname">SplDoublyLinkedList::push()</a></span>,
     <span class="methodname"><a href="spldoublylinkedlist.unshift.html" class="methodname">SplDoublyLinkedList::unshift()</a></span> and
     <span class="methodname"><a href="splqueue.enqueue.html" class="methodname">SplQueue::enqueue()</a></span> now return <span class="type"><span class="type void">void</span></span> instead of <strong><code>true</code></strong>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.spl-autoload-register.html" class="function">spl_autoload_register()</a></span> will now always throw a
     <span class="classname"><a href="class.typeerror.html" class="classname">TypeError</a></span> on invalid arguments, therefore the second argument
     <code class="parameter">do_throw</code> is ignored and a notice will be emitted if it is set to <strong><code>false</code></strong>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="classname"><a href="class.splfixedarray.html" class="classname">SplFixedArray</a></span> is now an <span class="interfacename"><a href="class.iteratoraggregate.html" class="interfacename">IteratorAggregate</a></span>
     and not an <span class="interfacename"><a href="class.iterator.html" class="interfacename">Iterator</a></span>.
     <span class="methodname"><a href="splfixedarray.rewind.html" class="methodname">SplFixedArray::rewind()</a></span>, <span class="methodname"><a href="splfixedarray.current.html" class="methodname">SplFixedArray::current()</a></span>,
     <span class="methodname"><a href="splfixedarray.key.html" class="methodname">SplFixedArray::key()</a></span>, <span class="methodname"><a href="splfixedarray.next.html" class="methodname">SplFixedArray::next()</a></span>, and
     <span class="methodname"><a href="splfixedarray.valid.html" class="methodname">SplFixedArray::valid()</a></span> have been removed. In their place,
     <span class="methodname"><strong>SplFixedArray::getIterator()</strong></span> has been added. Any code which uses explicit
     iteration over SplFixedArray must now obtain an
     <span class="interfacename"><a href="class.iterator.html" class="interfacename">Iterator</a></span> through
     <span class="methodname"><strong>SplFixedArray::getIterator()</strong></span>. This means that
     <span class="classname"><a href="class.splfixedarray.html" class="classname">SplFixedArray</a></span> is now safe to use in nested loops.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.standard">
  <h3 class="title">Standard Library</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.assert.html" class="function">assert()</a></span> will no longer evaluate string arguments, instead they will be
     treated like any other argument. <code class="code">assert($a == $b)</code> should be used instead of
     <code class="code">assert(&#039;$a == $b&#039;)</code>. The <a href="info.configuration.html#ini.assert.quiet-eval" class="link">assert.quiet_eval</a> ini directive and the
     <strong><code>ASSERT_QUIET_EVAL</code></strong> constant have also been removed, as they would no longer
     have any effect.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.parse-str.html" class="function">parse_str()</a></span> can no longer be used without specifying a result array.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <a href="filters.string.html#filters.string.strip_tags" class="link">string.strip_tags</a> filter has been removed.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <code class="parameter">needle</code> argument of <span class="function"><a href="function.strpos.html" class="function">strpos()</a></span>,
     <span class="function"><a href="function.strrpos.html" class="function">strrpos()</a></span>, <span class="function"><a href="function.stripos.html" class="function">stripos()</a></span>, <span class="function"><a href="function.strripos.html" class="function">strripos()</a></span>,
     <span class="function"><a href="function.strstr.html" class="function">strstr()</a></span>, <span class="function"><a href="function.strchr.html" class="function">strchr()</a></span>, <span class="function"><a href="function.strrchr.html" class="function">strrchr()</a></span>, and
     <span class="function"><a href="function.stristr.html" class="function">stristr()</a></span> will now always be interpreted as a string. Previously non-string
     needles were interpreted as an ASCII code point. An explicit call to <span class="function"><a href="function.chr.html" class="function">chr()</a></span> can
     be used to restore the previous behavior.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <code class="parameter">needle</code> argument for <span class="function"><a href="function.strpos.html" class="function">strpos()</a></span>,
     <span class="function"><a href="function.strrpos.html" class="function">strrpos()</a></span>, <span class="function"><a href="function.stripos.html" class="function">stripos()</a></span>, <span class="function"><a href="function.strripos.html" class="function">strripos()</a></span>,
     <span class="function"><a href="function.strstr.html" class="function">strstr()</a></span>, <span class="function"><a href="function.stristr.html" class="function">stristr()</a></span> and <span class="function"><a href="function.strrchr.html" class="function">strrchr()</a></span> can
     now be empty.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <code class="parameter">length</code> argument for <span class="function"><a href="function.substr.html" class="function">substr()</a></span>,
     <span class="function"><a href="function.substr-count.html" class="function">substr_count()</a></span>, <span class="function"><a href="function.substr-compare.html" class="function">substr_compare()</a></span>, and
     <span class="function"><a href="function.iconv-substr.html" class="function">iconv_substr()</a></span> can now be <strong><code>null</code></strong>. <strong><code>null</code></strong> values will behave as if no length
     argument was provided and will therefore return the remainder of the string instead of an empty
     string.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <code class="parameter">length</code> argument for <span class="function"><a href="function.array-splice.html" class="function">array_splice()</a></span> can now be
     <strong><code>null</code></strong>. <strong><code>null</code></strong> values will behave identically to omitting the argument, thus removing everything
     from the <code class="parameter">offset</code> to the end of the array.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <code class="parameter">args</code> argument of <span class="function"><a href="function.vsprintf.html" class="function">vsprintf()</a></span>,
     <span class="function"><a href="function.vfprintf.html" class="function">vfprintf()</a></span>, and <span class="function"><a href="function.vprintf.html" class="function">vprintf()</a></span> must now be an array. Previously
     any type was accepted.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <code class="literal">&#039;salt&#039;</code> option of <span class="function"><a href="function.password-hash.html" class="function">password_hash()</a></span> is no longer
     supported. If the <code class="literal">&#039;salt&#039;</code> option is used a warning is generated, the provided
     salt is ignored, and a generated salt is used instead.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <span class="function"><a href="function.quotemeta.html" class="function">quotemeta()</a></span> function will now return an empty string if an empty string
     was passed. Previously <strong><code>false</code></strong> was returned.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The following functions have been removed:
    </p>
    <p class="para">
     <ul class="simplelist">
      <li class="member"><span class="function"><a href="function.hebrevc.html" class="function">hebrevc()</a></span></li>
      <li class="member"><span class="function"><a href="function.convert-cyr-string.html" class="function">convert_cyr_string()</a></span></li>
      <li class="member"><span class="function"><a href="function.money-format.html" class="function">money_format()</a></span></li>
      <li class="member"><span class="function"><a href="function.ezmlm-hash.html" class="function">ezmlm_hash()</a></span></li>
      <li class="member"><span class="function"><a href="function.restore-include-path.html" class="function">restore_include_path()</a></span></li>
      <li class="member"><span class="function"><a href="function.get-magic-quotes-gpc.html" class="function">get_magic_quotes_gpc()</a></span></li>
      <li class="member"><span class="function"><a href="function.get-magic-quotes-runtime.html" class="function">get_magic_quotes_runtime()</a></span></li>
      <li class="member"><span class="function"><a href="function.fgetss.html" class="function">fgetss()</a></span></li>
     </ul>
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <strong><code>FILTER_SANITIZE_MAGIC_QUOTES</code></strong> has been removed.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     Calling <span class="function"><a href="function.implode.html" class="function">implode()</a></span> with parameters in a reverse order <code class="code">($pieces,
     $glue)</code> is no longer supported.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.parse-url.html" class="function">parse_url()</a></span> will now distinguish absent and empty queries and fragments:
    </p>
    <p class="para">
     <ul class="simplelist">
      <li class="member"><code class="code">http://example.com/foo → query = null, fragment = null</code></li>
      <li class="member"><code class="code">http://example.com/foo? → query = &quot;&quot;,   fragment = null</code></li>
      <li class="member"><code class="code">http://example.com/foo# → query = null, fragment = &quot;&quot;</code></li>
      <li class="member"><code class="code">http://example.com/foo?# → query = &quot;&quot;,   fragment = &quot;&quot;</code></li>
     </ul>
      Previously all cases resulted in query and fragment being <strong><code>null</code></strong>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.var-dump.html" class="function">var_dump()</a></span> and <span class="function"><a href="function.debug-zval-dump.html" class="function">debug_zval_dump()</a></span> will now print
     floating-point numbers using <a href="ini.core.html#ini.serialize-precision" class="link">serialize_precision</a>
     rather than <a href="ini.core.html#ini.precision" class="link">precision</a>. In a default configuration, this
     means that floating-point numbers are now printed with full accuracy by these debugging
     functions.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     If the array returned by <a href="language.oop5.magic.html#object.sleep" class="link">__sleep()</a> contains non-existing
     properties, these are now silently ignored. Previously, such properties would have been
     serialized as if they had the value <strong><code>null</code></strong>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The default locale on startup is now always <code class="literal">&quot;C&quot;</code>. No locales are inherited from
     the environment by default. Previously, <strong><code>LC_ALL</code></strong> was set to
     <code class="literal">&quot;C&quot;</code>, while <strong><code>LC_CTYPE</code></strong> was inherited from the environment.
     However, some functions did not respect the inherited locale without an explicit
     <span class="function"><a href="function.setlocale.html" class="function">setlocale()</a></span> call. An explicit <span class="function"><a href="function.setlocale.html" class="function">setlocale()</a></span> call is now
     always required if a locale component should be changed from the default.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The deprecated DES fallback in <span class="function"><a href="function.crypt.html" class="function">crypt()</a></span> has been removed. If an unknown salt
     format is passed to <span class="function"><a href="function.crypt.html" class="function">crypt()</a></span>, the function will fail with <code class="literal">*0</code>
     instead of falling back to a weak DES hash now.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     Specifying out of range rounds for SHA256/SHA512 <span class="function"><a href="function.crypt.html" class="function">crypt()</a></span> will now fail with
     <code class="literal">*0</code> instead of clamping to the closest limit. This matches glibc behavior.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The result of sorting functions may have changed, if the array contains elements that compare as
     equal.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     Any functions accepting callbacks that are not explicitly specified to accept parameters by
     reference will now warn if a callback with reference parameters is used. Examples include
     <span class="function"><a href="function.array-filter.html" class="function">array_filter()</a></span> and <span class="function"><a href="function.array-reduce.html" class="function">array_reduce()</a></span>. This was already the
     case for most, but not all, functions previously.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The HTTP stream wrapper as used by functions like <span class="function"><a href="function.file-get-contents.html" class="function">file_get_contents()</a></span>
     now advertises HTTP/1.1 rather than HTTP/1.0 by default. This does not change the behavior of the
     client, but may cause servers to respond differently. To retain the old behavior, set the
     <code class="literal">&#039;protocol_version&#039;</code> stream context option, e.g.
    </p>
    <p class="para">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$ctx&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">stream_context_create</span><span style="color: #007700">([</span><span style="color: #DD0000">'http'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;[</span><span style="color: #DD0000">'protocol_version'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'1.0'</span><span style="color: #007700">]]);<br />echo&nbsp;</span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://example.org'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$ctx</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

    </p>
   </li>
   <li class="listitem">
    <p class="para">
     Calling <span class="function"><a href="function.crypt.html" class="function">crypt()</a></span> without an explicit salt is no longer supported. If you would
     like to produce a strong hash with an auto-generated salt, use
     <span class="function"><a href="function.password-hash.html" class="function">password_hash()</a></span> instead.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
    <span class="function"><a href="function.substr.html" class="function">substr()</a></span>, <span class="function"><a href="function.mb-substr.html" class="function">mb_substr()</a></span>, <span class="function"><a href="function.iconv-substr.html" class="function">iconv_substr()</a></span> and
    <span class="function"><a href="function.grapheme-substr.html" class="function">grapheme_substr()</a></span> now consistently clamp out-of-bounds offsets to the string
    boundary. Previously, <strong><code>false</code></strong> was returned instead of the empty string in some cases.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     On Windows, the program execution functions (<span class="function"><a href="function.proc-open.html" class="function">proc_open()</a></span>, <span class="function"><a href="function.exec.html" class="function">exec()</a></span>,
     <span class="function"><a href="function.popen.html" class="function">popen()</a></span> etc.) using the shell, now consistently execute <strong class="command">%comspec% /s
     /c &quot;$commandline&quot;</strong>, which has the same effect as executing
     <strong class="command">$commandline</strong> (without additional quotes).
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.sysvsem">
  <h3 class="title">Sysvsem</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.sem-get.html" class="function">sem_get()</a></span> 的 <code class="parameter">auto_release</code> 参数已从接受 int
     更改为接受 bool。
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.tidy">
  <h3 class="title">Tidy</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     从 <span class="function"><a href="tidy.repairstring.html" class="function">tidy_repair_string()</a></span> 中删除内部未使用的 
     <code class="parameter">use_include_path</code> 参数。
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="methodname"><a href="tidy.repairstring.html" class="methodname">tidy::repairString()</a></span> 和 <span class="methodname"><a href="tidy.repairfile.html" class="methodname">tidy::repairFile()</a></span> 成为静态方法。
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.tokenizer">
  <h3 class="title">Tokenizer</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     <code class="literal">T_COMMENT</code> 记号将不再包含尾随的换行符。换行符将成为以下 <code class="literal">T_WHITESPACE</code>
     记号的一部分。需要注意的是，<code class="literal">T_COMMENT</code> 后面并不总是跟空格，也可能跟着
     <code class="literal">T_CLOSE_TAG</code> 或者文件结尾。
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     命名空间名称现在使用 <code class="literal">T_NAME_QUALIFIED</code>（<code class="code">Foo\Bar</code>）、<code class="literal">T_NAME_FULLY_QUALIFIED</code>（<code class="code">\Foo\Bar</code>）
     和 <code class="literal">T_NAME_RELATIVE</code>（<code class="code">namespace\Foo\Bar</code>）记号表示。
     <code class="literal">T_NS_SEPARATOR</code> is only used for standalone namespace separators, and only
     syntactially valid in conjunction with group use declarations.
     
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.xmlreader">
  <h3 class="title">XMLReader</h3>

  <p class="para">
   <span class="methodname"><a href="xmlreader.open.html" class="methodname">XMLReader::open()</a></span> 和 <span class="methodname"><a href="xmlreader.xml.html" class="methodname">XMLReader::xml()</a></span>
   现在是静态方法。也可以作为实例方法调用，但如果继承类需要覆盖这些方法，要声明为 static。
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.xmlrpc">
  <h3 class="title">XML-RPC</h3>

  <p class="para">
   XML-RPC 扩展已移动到 PECL，不再是 PHP 发行版的一部分。
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.zip">
  <h3 class="title">Zip</h3>

  <p class="para">
   <strong><code>ZipArchive::OPSYS_Z_CPM</code></strong> 已移除（名字错误）。使用
   <strong><code>ZipArchive::OPSYS_CPM</code></strong> 代替。
  </p>
 </div>

 <div class="sect2" id="migration80.incompatible.zlib">
  <h3 class="title">Zlib</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.gzgetss.html" class="function">gzgetss()</a></span> 已移除。
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <a href="zlib.configuration.html#ini.zlib.output-compression" class="link">zlib.output_compression</a> 不再对
     <code class="literal">Content-Type: image/*</code> 自动禁用。
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.incompatible.php-test-packs">
  <h3 class="title">Windows PHP 测试包</h3>

  <p class="para">
   测试运行器从 <var class="filename">run-test.php</var> 重命名为 <var class="filename">run-tests.php</var>，以匹配其在
   php-src 中的名字。
  </p>
 </div>
</div></div></div></body></html>